/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2018-03-22     quanzhao     first version
 */

#ifndef __T113_H__
#define __T113_H__

/* for 'rt_inline' */
#include <rtdef.h>
/* SOC-relative definitions */
#include "t113_irqnum.h"

#define __REG32(x)  (*((volatile unsigned int *)(x)))
#define __REG16(x)  (*((volatile unsigned short *)(x)))


/* the maximum entries of the exception table */
#define MAX_HANDLERS        t113_IRQ_COUNT
/* number of interrupts on board */
#define ARM_GIC_NR_IRQS     t113_IRQ_COUNT
/* only one GIC available */
#define ARM_GIC_MAX_NR      1

/* the basic constants and interfaces needed by gic */
rt_inline rt_uint32_t platform_get_gic_dist_base(void)
{
    return T113_GIC_DIST_BASE;
}

rt_inline rt_uint32_t platform_get_gic_cpu_base(void)
{
    return T113_GIC_CPU_BASE;
}

#define GIC_IRQ_START   0

#define GIC_ACK_INTID_MASK  0x000003ff

#endif  /* __T113_H__ */
